<?php



if( count( $this->activities ) ) :
            
    $today = date( 'Y-m-d' );
    $tomorrow = date( 'Y-m-d', strtotime( '+1 day' ) );
    
foreach( $this->activities as $k => $day ):
    
//    if( strtotime( $k ) < strtotime( $today ) )
//        continue;
    
    list($y, $m, $d ) = explode( '-', $k );
    ?>
    <tr class="<?php echo ( $k == $today ) ? 'today' : 'selectable'?>">
        <td class="date">
            <h3>
                <?php if( $k == $today ): ?>
                <b>Oggi</b>
                <span><?php echo $d ?> <?php echo $this->months[sprintf( '%01d', $m )] ?> <?php echo $y ?></span>
                <?php elseif( date( 'Y-m-d', strtotime( $k ) ) == $tomorrow ): ?>
                <b>Domani</b>
                <span><?php echo $d ?> <?php echo $this->months[sprintf( '%01d', $m )] ?> <?php echo $y ?></span>
                <?php else: ?>
                <b><?php echo $d ?> <?php echo $this->months[sprintf( '%01d', $m )] ?> <?php echo $y ?></b>
                <span><?php echo $this->days[date( 'N', mktime( $hour, $minute, $second, $m, $d, $y ) )] ?></span>
                <?php endif; ?>            
            </h3>		
        </td>
        <td>
            <div class="day">
                    <?php foreach( $day as $activity ): ?>
                        <div class="activity">
                            <div class="title">
                                <strong><?php echo $activity['activity_title'] ?></strong>
                            </div>
                            <div class="description">&nbsp;
                            <?php if( !is_null( $activity['activity_description'] ) ) : ?>
                            <a href="">
                                <img class="description-icon" src="/images/admin/16x16/information.png">
                                <div class="tooltip">
                                    <?php echo $activity['activity_description'] ?>
                                </div>
                            </a>
                            <?php endif; ?>
                            </div>
                            <div class="assignedto">&nbsp;
                                <?php echo !is_null( $activity['activity_assignedto'] ) ? 'Assegnato a: <b>'. $activity['user_firstname'] .' '. $activity['user_lastname'] .'</b>' : '' ?>
                            </div>
                            <span class="actions">
                                <a class="edit" href="/admin/attivita/info/id/<?php echo $activity['activity_id'] ?>">Edit</a>
                                <a class="del" href="">Canc</a>
                            </span>
                        </div>
                    <?php 
                    endforeach;?>            
            </div>
        </td>
    </tr>

    <?php
    endforeach;
else:
    ?><tr class="result"><td colspan="5">Nessun elemento presente...</td></tr> <?php	
endif;?>